<template>
  <div>
    <van-nav-bar
        title="订单信息"
        left-text="返回"
        left-arrow
        @click-left="back"
    />
    <div style="margin-bottom: 50px">
      <van-cell-group v-for="(i,index) in list"
                      :key="index"
      >
        <div>
          <van-cell :title="i.address.name+'  '+i.address.phone">
            <template #default>
  <!--            <label>{{i.address.name}}</label>-->
              <label>订单号：{{i.address.no}}</label><br/>
              <label>{{i.address.city}}省{{i.address.country}}</label><br>
              <label>实付金额：{{i.address.paymoney}}</label><br>
              <label>备注信息：{{i.address.info}}</label>
              <van-cell v-if="i.foodCoupondto.couponDto.length>0" :title="i.foodCoupondto.couponDto[0].info" />
            </template>
          </van-cell>

          <van-card v-for="(i,index) in i.foodCoupondto.foodDtos"
                    :key="index"
              :num="i.num"
              :price="i.currentprice"
              :title="i.title"
              :thumb="i.imgurl"
              :origin-price="i.freemoney"
          />
        </div>
        <van-button @click="paymoney">立即付款</van-button>
      </van-cell-group>

    </div>


  </div>
</template>
<script>
export default {
  data(){
    return{
      list:[],

    }
  },mounted() {
    this.axios.get("/api/order/orderquery.do").then(res=>{
      // console.log(res.data.data);
      this.list = res.data.data;
      console.log(this.list)
    })
  },
  methods: {
    back(){
      this.$router.push("/my");
    },
    paymoney(){
      var dto={
        "no":Date.parse(new Date())/1000,
        "title":"jjjj",
        "money":0.01,
        "type":1,

      }
      this.no = dto.no;
      this.axios.post("/api/alipay/sendpay.do",dto).then(res=> {
        if (res.data.code == 200) {
          var orderdto = {
            "paytype": 1,
            "no": this.no,
            "info": this.info,
            "type": 2,
            "aid": this.index1,
            "cids": this.cids,
            "foods": this.orderpre.foods,
            "score": this.score,
            "couponid": this.couponinfodto.coupid,
          }
        }
      })
    }
  }
}
</script>